package isquirrel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

import net.roarsoftware.lastfm.Artist;

import org.junit.Test;

public class LastfmTest {

	
	String artist1 = "Metallica";
	
	String artist2 = "Spice Girls";
	
	String artist3 = "Michael Jackson";

	Lastfm lfm = new Lastfm();
	ArrayList<String> keywords = new ArrayList<String>();
	
	@Test
	public void testGetSimilarArtists() {
		Collection<Artist> dm = lfm.getSimilarArtists(artist1, 10);
		assert(dm.size() == 10);
		for (Artist artist : dm) 
			System.out.println(artist.getName());
	}

	@Test
	public void testGetArtistsByKeywords() {
		keywords.add("Football");
		keywords.add("pop");
		keywords.add("microsoft");
		keywords.add("computers");
		keywords.add("basketball");
		keywords.add("travelling");
		keywords.add("religion");
		keywords.add("photography");
		keywords.add("going out with friends");
		keywords.add("cooking");
		keywords.add("swimming");
		keywords.add("aeroplanes");
		HashMap<String, Collection<Artist>> artists = lfm.getArtistsByKeywords(keywords, 3);
		
		assert(keywords.size() == artists.size());

		for (String s : artists.keySet()) {
			Collection<Artist> artistsPerKeyword = 
									artists.get(s);
			if (artistsPerKeyword != null) {
//				System.out.println(" \t Artists for Keyword: " + s);
				for (Artist artist : artistsPerKeyword){
					System.out.println(" \t \t \t " + artist.getName());
				}
			}
			else {
				System.out.println(" \n \t Could not find artists for: " + s + "\n");
			}
		}
	}

	@Test
	public void testGetTopAlbumsByKeywords() {
		
	}

}
